<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%String path = request.getContextPath() ;%>
<%@ taglib uri="/WEB-INF/tld/c.tld" prefix="c" %>
<%@ taglib uri="/WEB-INF/tld/ui.tld" prefix="ui" %>
<!DOCTYPE html>
<html lang="zh-CN" >
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
	<title>敞口信息</title>
	<jsp:include page="../../import.jsp" flush="true" />
</head>

<body class="iframeBody">
<div class="Wrapper">
	<div id="pageInTab" class="pageInTab">
		<div tabid="tabA" title="敞口统计" lselected="true">
			<div id="ligergrid1" class="sq-grid">
			</div>
		</div>
	</div>
</div>

<script type="text/javascript">
    var pageInApp={
        flag:true
    }; // to 下一级子窗口 接口
    var pageInTab=null;
    var loadedTabs=[]
    var grid = null,
        Editable=true;
    var _dataId = '${dataId}';
    var _type = '${type}';
    $(function () {
        initTab();

        grid =  $("#ligergrid1").ligerGrid({
            url: '<%=path%>/splCap/capPrjAr/getCapPrjArInfo.do?dataId='+_dataId + '&type='+_type,
            method : 'get',
            columns: [
                { display: '主体类型', name: 'mainTypCd', width: 100,
                    render: function (rowdata, rowindex, value) {
                    	var mainName = '';
                        if (rowdata.mainTypCd == '1') {
                            mainName = '承租人';
						}else if(rowdata.mainTypCd == '2'){
                            mainName = '担保人';
						}else if(rowdata.mainTypCd == '3'){
                            mainName = '挂靠公司';
                        }else{
                            mainName = '供应商';
                        }
                        return mainName;
                    },enabledSort:false },
                { display: '主体ID', name: 'id', minWidth: 100,hide:true,enabledSort:true},
                { display: '主体名称', name: 'mainNm', minWidth: 100,enabledSort:true},
                { display: '融资/担保情况', name: 'rzOrDb', minWidth: 100,
                    render: function (rowdata, rowindex, value) {
                        var h = '';
                        if (rowdata.rzOrDb == '0') {
                            h = '融资';
                        }else if(rowdata.rzOrDb == '1'){
                            h = '担保';
                        }
                        return h;
                    },enabledSort:true },
                { display: '车辆类型', name: 'carType', minWidth: 100 ,
                    render: function (rowdata, rowindex, value) {
                        var h = '';
                        if (rowdata.carType == '0') {
                            h = '二手车';
                        }else if(rowdata.carType == '1'){
                            h = '新车';
                        }else {
                            h = '总计';
						}
                        return h;
                    },
                    enabledSort:true},
                { display: '历史30+逾期次数', name: '', minWidth: 150,
					//根据主体类型 融资OR担保 新车OR二手车 分别显示数据
                    render: function (rowdata, rowindex, value) {
                       	var result = '';
                       	if(rowdata.mainId == null || rowdata.mainNm == null){
                       		return result;
						}
                       	if(rowdata.recordType == '0'){
                                if(rowdata.rzOrDb == '0') {
                                    if (rowdata.carType == '1') {
                                        result = rowdata.flNewOvdHisCnt;
                                    } else {
                                        result = rowdata.flUsedOvdHisCnt;
                                    }
                                }else{
                                    if(rowdata.carType == '1'){
                                        result = rowdata.gtNewOvdHisCnt;

                                    }else{
                                        result = rowdata.gtUsedOvdHisCnt;
                                    }
								}
						}else{
                            result = rowdata.totalOvdHisCnt;
						}

                        return result+"";
                    }, enabledSort:true},
                { display: '当前逾期的支付表数', name: 'refIsValidNm', minWidth: 150 ,
                    //根据主体类型 融资OR担保 新车OR二手车 分别显示数据
                    render: function (rowdata, rowindex, value) {
                        var result = '';
						if(rowdata.mainId == null || rowdata.mainNm == null){
							return result;
						}
                        if(rowdata.recordType == '0') {
                            if (rowdata.rzOrDb == '0') {
                                if (rowdata.carType == '1') {
                                    result = rowdata.flNewOvdCnt;
                                } else {
                                    result = rowdata.flUsedOvdCnt;
                                }
                        	} else {
                            	if (rowdata.carType == '1') {
									result = rowdata.gtNewOvdCnt;
								} else {
									result = rowdata.gtUsedOvdCnt;
								}
                        	}
                        }else{
                            result = rowdata.totalOvdCnt;
						}

                        return result+"";
                    },enabledSort:true},
                { display: 'A：已发起评审流程且未通过的支付表敞口', name: 'refIsValidNm', minWidth: 150 ,
                    //根据主体类型 融资OR担保 新车OR二手车 分别显示数据
                    render: function (rowdata, rowindex, value) {
                        var result = '';
						if(rowdata.mainId == null || rowdata.mainNm == null){
							return result;
						}
                        if(rowdata.recordType == '0'){
                                if(rowdata.rzOrDb == '0'){
                                    if(rowdata.carType == '1'){
                                        result = rowdata.flNewPrjAudAmt;
                                    }else{
                                        result = rowdata.flUsedPrjAudAmt;
                                    }
                                }else{
                                    if(rowdata.carType == '1'){
                                        result = rowdata.gtNewPrjAudAmt;
                                    }else{
                                        result = rowdata.gtUsedPrjAudAmt;
                                    }
								}
						}else{
                            result = rowdata.gtTotalPrjAudAmt;
						}

                        return FormatMoney(result/100);
                    },enabledSort:true},
                { display: 'B：评审通过未放款的支付表敞口', name: '', minWidth: 150 ,
                    //根据主体类型 融资OR担保 新车OR二手车 分别显示数据
                    render: function (rowdata, rowindex, value) {
                        var result = '';
						if(rowdata.mainId == null || rowdata.mainNm == null){
							return result;
						}
                        if(rowdata.recordType == '0'){
                                if(rowdata.rzOrDb == '0'){
                                    if(rowdata.carType == '1'){
                                        result = rowdata.flNewPayAmt;
                                    }else{
                                        result = rowdata.flUsedPayAmt;
                                    }
                                }else{
                                    if(rowdata.carType == '1'){
                                        result = rowdata.gtNewPayAmt;
                                    }else{
                                        result = rowdata.gtUsedPayAmt;
                                    }
								}
						}else{
                            result = rowdata.gtTotalPayAmt;
						}

                        return FormatMoney(result/100);
                    },enabledSort:true},
                { display: 'C：已放款支付表剩余敞口', name: '', minWidth: 150 ,
                    //根据主体类型 融资OR担保 新车OR二手车 分别显示数据
                    render: function (rowdata, rowindex, value) {
                        var result = '';
						if(rowdata.mainId == null || rowdata.mainNm == null){
							return result;
						}
                        if(rowdata.recordType == '0'){
                                if(rowdata.rzOrDb == '0'){
                                    if(rowdata.carType == '1'){
                                        result = rowdata.flNewPaidAmt;
                                    }else{
                                        result = rowdata.flUsedPaidAmt;
                                    }
                                }else{
                                    if(rowdata.carType == '1'){
                                        result = rowdata.gtNewPaidAmt;
                                    }else{
                                        result = rowdata.gtUsedPaidAmt;
                                    }
								}
						}else{
                            result = rowdata.gtTotalPaidAmt;
						}

                        return FormatMoney(result/100);
                    },enabledSort:true},
                { display: '敞口合计：A+B+C', name: '', minWidth: 150 ,
                    //根据主体类型 融资OR担保 新车OR二手车 分别显示数据
                    render: function (rowdata, rowindex, value) {
                        var result = '';
						if(rowdata.mainId == null || rowdata.mainNm == null){
							return result;
						}
                        if(rowdata.recordType == '0'){
                                if(rowdata.rzOrDb == '0'){
                                    if(rowdata.carType == '1'){
                                        result = rowdata.flNewPrjAudAmt + rowdata.flNewPayAmt + rowdata.flNewPaidAmt;
                                    }else{
                                        result = rowdata.flUsedPrjAudAmt + rowdata.flUsedPayAmt + rowdata.flUsedPaidAmt;
                                    }
                                }else{
                                    if(rowdata.carType == '1'){
                                        result = rowdata.gtNewPrjAudAmt + rowdata.gtNewPayAmt + rowdata.gtNewPaidAmt;
                                    }else{
                                        result = rowdata.gtUsedPrjAudAmt + rowdata.gtUsedPayAmt + rowdata.gtUsedPaidAmt;
                                    }
								}
						}else{
                            result = rowdata.gtTotalPrjAudAmt + rowdata.gtTotalPayAmt + rowdata.gtTotalPaidAmt;
                        }


                        return FormatMoney(result/100);
                    },enabledSort:true},


            ],
            pageSize:100,
            pageSizeOptions: [100],
            root:'rows',
            record:'total',
            hideLoadButton : true,
            width: '100%',
            isScroll: false,
            checkbox:true,
            rownumbers:true,
            onAfterShowData: function () {
                $('#ligergrid1').rowspan('mainTypCd');
                $('#ligergrid1').rowspan('id');
                $('#ligergrid1').rowspan('mainNm');
                $('#ligergrid1').rowspan('rzOrDb');
                $('#ligergrid1').rowspan('carType');
            }
        });


        $("#pageloading").hide();



    });

    //初始化Tab
    function initTab(){
        pageInTab = $("#pageInTab").ligerTab({
            height: 'auto',
            contextmenu: false,
            minIframeHeight: GET_minIframeHeight(),
            onBeforeSelectTabItem: function (tabid) {
                if(tabid!="tabA"){

                }
            },
            onAfterSelectTabItem: function(tabid) {
                if (loadedTabs.indexOf(tabid)<0) {
                    loadedTabs.push(tabid);
                    switch (tabid){
                        case "tabB":
                            pageInTab.setTabItemSrc(tabid, "<%=path%>/system/sysUsr/toSplUsrListPage.do");
                            break;
                    }
                };
                SetIframe_height();
            }
        });

        $.extend(true, pageInApp, {
            pageInTab: pageInTab
        });
    };





    function iframeResize_pageIn () {
        if (parent.pageInApp) {
            parent.pageInApp.pageInTab.onResize();
            iframeResize ()
        };
    }
    function iframeResize () {
        if (parent.parent.mainApp) {
            parent.parent.mainApp.parentTab.onResize();
        };
    }




</script>
</body>
</html>
